
var minIO = require('minio')
var minIOClient = new minIO.Client({
    endPoint: 'oss.domain.net',
    port: 9001,   // 80 到 8080 到 9001
    useSSL: false,
    accessKey: 'key',
    secretKey: 'secret'
});


const 桶名 = "name";
module.exports = {
    serverURL: "oss.domain.net",
    put(objectName, stream, contentType = "application/octet-stream")
    {
        return new Promise(async (resolve, reject) => {
            minIOClient.putObject(
                桶名,
                objectName,
                stream,
                contentType,
                (err, info) => {
                    if (err) {
                        console.error(err);
                        reject(err);
                    } else {
                        resolve(info);
                    }
                }
            );
        }); 
    },
};

